package com.example.origin.demo.demo;

import lombok.SneakyThrows;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.ForkJoinPool;

public class FileInOutDemo {
    @SneakyThrows
    public static void main(String[] args) {
        List<String> list = Files.readAllLines(Paths.get("D:\\documents\\java面试\\入职资料","en.txt"));
        for (String s : list) {
//            if ((s.lastIndexOf(".")==s.length()-1||s.lastIndexOf("?")==s.length()-1)
//            && s.lastIndexOf("c.")!=s.length()-2
//            && s.lastIndexOf("u.")!=s.length()-2
//            && s.lastIndexOf("i.")!=s.length()-2
//            && s.lastIndexOf("t.")!=s.length()-2) {
//                System.out.println(s);
//            }
            if (s.contains("sth")){
                s = s.replace("sth", "something");
            }
            if (s.contains("sb")){
                s = s.replace("sb", "somebody");
            }
            if ((s.lastIndexOf(".")!=s.length()-1
                    &&s.lastIndexOf("。")!=s.length()-1&&s.lastIndexOf("？")!=s.length()-1&&
                    s.lastIndexOf("?")!=s.length()-1)){
                System.out.println(s+".");
            }else {
                System.out.println(s);
            }
        }

    }
}
